package frame1;

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.xml.crypto.dsig.keyinfo.KeyValue;

import java.awt.Toolkit;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JPasswordField;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;

public class Demo1 extends JFrame {

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Demo1 frame = new Demo1();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Demo1() {
		setIconImage(Toolkit.getDefaultToolkit().getImage(Demo1.class.getResource("/image/6200e46ajw1e8qgp5bmzyj2050050aa8.jpg")));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(200, 200, 450, 300);
		getContentPane().setLayout(new BorderLayout(3, 3));
		JButton btn = new JButton("按钮1");
		
		getContentPane().add(btn, BorderLayout.EAST);
		
		JButton btn2 = new JButton("按钮2");
		getContentPane().add(btn2, BorderLayout.WEST);
		
		JButton btn3 = new JButton("按钮3");
		getContentPane().add(btn3, BorderLayout.NORTH);
		
		
		JButton btn4 = new JButton("按钮4");
		getContentPane().add(btn4, BorderLayout.SOUTH);
		
		CardLayout cl = new CardLayout();
		JPanel center = new JPanel();
		center.setLayout( cl );
		
		
		for(int i = 0; i < 10; i++){
			JButton b = new JButton("center" + i);
			center.add(b, "a" + i);
		}
		
		//cl.show(center, "a0");
		
		
		
		getContentPane().add(center, BorderLayout.CENTER);
		//this.pack();
		new  CardThread(center, cl).start();
	}
}
